home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import rhythmdb
- import rb
- import gobject
- import gtk
- import gtk.glade as gtk
- from JamendoSource import JamendoSource
- from JamendoConfigureDialog import JamendoConfigureDialog
- popup_ui = '\n<ui>\n <popup name="JamendoSourceViewPopup">\n <menuitem name="AddToQueueLibraryPopup" action="AddToQueue"/>\n <menuitem name="JamendoDownloadAlbum" action="JamendoDownloadAlbum"/>\n <menuitem name="JamendoDonateArtist" action="JamendoDonateArtist"/>\n <separator/>\n <menuitem name="BrowseGenreLibraryPopup" action="BrowserSrcChooseGenre"/>\n <menuitem name="BrowseArtistLibraryPopup" action="BrowserSrcChooseArtist"/>\n <menuitem name="BrowseAlbumLibraryPopup" action="BrowserSrcChooseAlbum"/>\n <separator/>\n <menuitem name="PropertiesLibraryPopup" action="MusicProperties"/>\n </popup>\n</ui>\n'
-
- class Jamendo(rb.Plugin):
-
- def __init__(self):
- rb.Plugin.__init__(self)
-
-
- def activate(self, shell):
- self.db = shell.get_property('db')
- self.entry_type = self.db.entry_register_type('JamendoEntryType')
- self.entry_type.can_sync_metadata = True
- self.entry_type.sync_metadata = None
- group = rb.rb_source_group_get_by_name('stores')
- if not group:
- group = rb.rb_source_group_register('stores', _('Stores'), rb.SOURCE_GROUP_CATEGORY_FIXED)
-
- theme = gtk.icon_theme_get_default()
- rb.append_plugin_source_path(theme, '/icons/')
- (width, height) = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
- icon = rb.try_load_icon(theme, 'jamendo', width, 0)
- self.source = gobject.new(JamendoSource, shell = shell, entry_type = self.entry_type, plugin = self, icon = icon, source_group = group)
- shell.register_entry_type_for_source(self.source, self.entry_type)
- shell.append_source(self.source, None)
- manager = shell.get_player().get_property('ui-manager')
- action = gtk.Action('JamendoDownloadAlbum', _('_Download Album'), _('Download this album using BitTorrent'), 'gtk-save')
- action.connect(('activate',), (lambda a: shell.get_property('selected-source').download_album()))
- self.action_group = gtk.ActionGroup('JamendoPluginActions')
- self.action_group.add_action(action)
- action = gtk.Action('JamendoDonateArtist', _('_Donate to Artist'), _('Donate Money to this Artist'), 'gtk-jump-to')
- action.connect(('activate',), (lambda a: shell.get_property('selected-source').launch_donate()))
- self.action_group.add_action(action)
- manager.insert_action_group(self.action_group, 0)
- self.ui_id = manager.add_ui_from_string(popup_ui)
- manager.ensure_update()
- self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
-
-
- def deactivate(self, shell):
- manager = shell.get_player().get_property('ui-manager')
- manager.remove_ui(self.ui_id)
- manager.remove_action_group(self.action_group)
- self.action_group = None
- shell.get_player().disconnect(self.pec_id)
- self.db.entry_delete_by_type(self.entry_type)
- self.db.commit()
- self.db = None
- self.entry_type = None
- self.source.delete_thyself()
- self.source = None
-
-
- def create_configure_dialog(self, dialog = None):
- if not dialog:
- glade_file = self.find_file('jamendo-prefs.glade')
- dialog = JamendoConfigureDialog(glade_file).get_dialog()
-
- dialog.present()
- return dialog
-
-
- def playing_entry_changed(self, sp, entry):
- self.source.playing_entry_changed(entry)
-
-
-